//
// Created by francklinson on 2021/12/31 AT 10:36.
//
#include <iostream>
#include <vector>
#include <unordered_map>
#include <queue>
#include <algorithm>
#include <functional>
#include <string>

using namespace std;

class Solution {
public:
    bool areNumbersAscending(string s) {
        // 1. 提取数字 2.判断递增
        int start = 0;
        int num = -1;
        for (int i = 0; i < s.size(); ++i) {
            if (i == s.size() - 1 || s[i + 1] == ' ') {
                string cur = s.substr(start, i - start + 1);
                if (isdigit(cur[0])) {
                    int curNum = stoi(cur);
                    if (curNum > num) {
                        num = curNum;
                    } else
                        return false;
                }
                start = i + 2;
            }
        }
        return true;
    }
};

int main() {
    Solution solution;
    cout << solution.areNumbersAscending("1 box has 2 blue 4 red 6 green and 12 yellow marbles") << endl;
    return 0;
}

